package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.PublicOpinionReportMapper;
import com.ruoyi.system.domain.PublicOpinionReport;
import com.ruoyi.system.service.IPublicOpinionReportService;

/**
 * 简报模板Service业务层处理
 * 
 * @author hwcazy
 * @date 2021-07-08
 */
@Service
public class PublicOpinionReportServiceImpl implements IPublicOpinionReportService 
{
    @Autowired
    private PublicOpinionReportMapper publicOpinionReportMapper;

    /**
     * 查询简报模板
     * 
     * @param id 简报模板ID
     * @return 简报模板
     */
    @Override
    public PublicOpinionReport selectPublicOpinionReportById(Long id)
    {
        return publicOpinionReportMapper.selectPublicOpinionReportById(id);
    }

    /**
     * 查询简报模板列表
     * 
     * @param publicOpinionReport 简报模板
     * @return 简报模板
     */
    @Override
    @DataScope(deptAlias = "report",userAlias = "report")
    public List<PublicOpinionReport> selectPublicOpinionReportList(PublicOpinionReport publicOpinionReport)
    {
        return publicOpinionReportMapper.selectPublicOpinionReportList(publicOpinionReport);
    }

    /**
     * 新增简报模板
     * 
     * @param publicOpinionReport 简报模板
     * @return 结果
     */
    @Override
    public int insertPublicOpinionReport(PublicOpinionReport publicOpinionReport)
    {
        publicOpinionReport.setCreateTime(DateUtils.getNowDate());
        return publicOpinionReportMapper.insertPublicOpinionReport(publicOpinionReport);
    }

    /**
     * 修改简报模板
     * 
     * @param publicOpinionReport 简报模板
     * @return 结果
     */
    @Override
    public int updatePublicOpinionReport(PublicOpinionReport publicOpinionReport)
    {
        publicOpinionReport.setUpdateTime(DateUtils.getNowDate());
        return publicOpinionReportMapper.updatePublicOpinionReport(publicOpinionReport);
    }

    /**
     * 批量删除简报模板
     * 
     * @param ids 需要删除的简报模板ID
     * @return 结果
     */
    @Override
    public int deletePublicOpinionReportByIds(Long[] ids)
    {
        return publicOpinionReportMapper.deletePublicOpinionReportByIds(ids);
    }

    /**
     * 删除简报模板信息
     * 
     * @param id 简报模板ID
     * @return 结果
     */
    @Override
    public int deletePublicOpinionReportById(Long id)
    {
        return publicOpinionReportMapper.deletePublicOpinionReportById(id);
    }
}
